import 'package:wch/generated/json/base/json_convert_content.dart';
import 'package:wch/model/hospital_congig_entity.dart';

HospitalCongigEntity $HospitalCongigEntityFromJson(Map<String, dynamic> json) {
  final HospitalCongigEntity hospitalCongigEntity = HospitalCongigEntity();
  final String? code = jsonConvert.convert<String>(json['code']);
  if (code != null) {
    hospitalCongigEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    hospitalCongigEntity.msg = msg;
  }
  final HospitalCongigData? data = jsonConvert.convert<HospitalCongigData>(
      json['data']);
  if (data != null) {
    hospitalCongigEntity.data = data;
  }
  return hospitalCongigEntity;
}

Map<String, dynamic> $HospitalCongigEntityToJson(HospitalCongigEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data?.toJson();
  return data;
}

extension HospitalCongigEntityExtension on HospitalCongigEntity {
  HospitalCongigEntity copyWith({
    String? code,
    String? msg,
    HospitalCongigData? data,
  }) {
    return HospitalCongigEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

HospitalCongigData $HospitalCongigDataFromJson(Map<String, dynamic> json) {
  final HospitalCongigData hospitalCongigData = HospitalCongigData();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    hospitalCongigData.id = id;
  }
  final String? hospitalId = jsonConvert.convert<String>(json['hospitalId']);
  if (hospitalId != null) {
    hospitalCongigData.hospitalId = hospitalId;
  }
  final List<String>? departmentIds = (json['departmentIds'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<String>(e) as String)
      .toList();
  if (departmentIds != null) {
    hospitalCongigData.departmentIds = departmentIds;
  }
  final String? isSignalQuality = jsonConvert.convert<String>(
      json['isSignalQuality']);
  if (isSignalQuality != null) {
    hospitalCongigData.isSignalQuality = isSignalQuality;
  }
  final String? isBlink = jsonConvert.convert<String>(json['isBlink']);
  if (isBlink != null) {
    hospitalCongigData.isBlink = isBlink;
  }
  final String? isLabelConfig = jsonConvert.convert<String>(
      json['isLabelConfig']);
  if (isLabelConfig != null) {
    hospitalCongigData.isLabelConfig = isLabelConfig;
  }
  final String? isPrivacySettings = jsonConvert.convert<String>(
      json['isPrivacySettings']);
  if (isPrivacySettings != null) {
    hospitalCongigData.isPrivacySettings = isPrivacySettings;
  }
  final String? isSleepIntervention = jsonConvert.convert<String>(
      json['isSleepIntervention']);
  if (isSleepIntervention != null) {
    hospitalCongigData.isSleepIntervention = isSleepIntervention;
  }
  final String? isPreSleepIntervention = jsonConvert.convert<String>(
      json['isPreSleepIntervention']);
  if (isPreSleepIntervention != null) {
    hospitalCongigData.isPreSleepIntervention = isPreSleepIntervention;
  }
  final String? isMidSleepIntervention = jsonConvert.convert<String>(
      json['isMidSleepIntervention']);
  if (isMidSleepIntervention != null) {
    hospitalCongigData.isMidSleepIntervention = isMidSleepIntervention;
  }
  final String? isGentleWakeup = jsonConvert.convert<String>(
      json['isGentleWakeup']);
  if (isGentleWakeup != null) {
    hospitalCongigData.isGentleWakeup = isGentleWakeup;
  }
  final String? isImpedance = jsonConvert.convert<String>(json['isImpedance']);
  if (isImpedance != null) {
    hospitalCongigData.isImpedance = isImpedance;
  }
  final int? blinkNum = jsonConvert.convert<int>(json['blinkNum']);
  if (blinkNum != null) {
    hospitalCongigData.blinkNum = blinkNum;
  }
  final String? wakeUpTime = jsonConvert.convert<String>(json['wakeUpTime']);
  if (wakeUpTime != null) {
    hospitalCongigData.wakeUpTime = wakeUpTime;
  }
  final List<
      HospitalCongigDataMusicFileList>? musicFileList = (json['musicFileList'] as List<
      dynamic>?)?.map(
          (e) =>
      jsonConvert.convert<HospitalCongigDataMusicFileList>(
          e) as HospitalCongigDataMusicFileList).toList();
  if (musicFileList != null) {
    hospitalCongigData.musicFileList = musicFileList;
  }
  final dynamic createTime = json['createTime'];
  if (createTime != null) {
    hospitalCongigData.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    hospitalCongigData.updateTime = updateTime;
  }
  return hospitalCongigData;
}

Map<String, dynamic> $HospitalCongigDataToJson(HospitalCongigData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['hospitalId'] = entity.hospitalId;
  data['departmentIds'] = entity.departmentIds;
  data['isSignalQuality'] = entity.isSignalQuality;
  data['isBlink'] = entity.isBlink;
  data['isLabelConfig'] = entity.isLabelConfig;
  data['isPrivacySettings'] = entity.isPrivacySettings;
  data['isSleepIntervention'] = entity.isSleepIntervention;
  data['isPreSleepIntervention'] = entity.isPreSleepIntervention;
  data['isMidSleepIntervention'] = entity.isMidSleepIntervention;
  data['isGentleWakeup'] = entity.isGentleWakeup;
  data['isImpedance'] = entity.isImpedance;
  data['blinkNum'] = entity.blinkNum;
  data['wakeUpTime'] = entity.wakeUpTime;
  data['musicFileList'] = entity.musicFileList?.map((v) => v.toJson()).toList();
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  return data;
}

extension HospitalCongigDataExtension on HospitalCongigData {
  HospitalCongigData copyWith({
    String? id,
    String? hospitalId,
    List<String>? departmentIds,
    String? isSignalQuality,
    String? isBlink,
    String? isLabelConfig,
    String? isPrivacySettings,
    String? isSleepIntervention,
    String? isPreSleepIntervention,
    String? isMidSleepIntervention,
    String? isGentleWakeup,
    String? isImpedance,
    int? blinkNum,
    String? wakeUpTime,
    List<HospitalCongigDataMusicFileList>? musicFileList,
    dynamic createTime,
    String? updateTime,
  }) {
    return HospitalCongigData()
      ..id = id ?? this.id
      ..hospitalId = hospitalId ?? this.hospitalId
      ..departmentIds = departmentIds ?? this.departmentIds
      ..isSignalQuality = isSignalQuality ?? this.isSignalQuality
      ..isBlink = isBlink ?? this.isBlink
      ..isLabelConfig = isLabelConfig ?? this.isLabelConfig
      ..isPrivacySettings = isPrivacySettings ?? this.isPrivacySettings
      ..isSleepIntervention = isSleepIntervention ?? this.isSleepIntervention
      ..isPreSleepIntervention = isPreSleepIntervention ??
          this.isPreSleepIntervention
      ..isMidSleepIntervention = isMidSleepIntervention ??
          this.isMidSleepIntervention
      ..isGentleWakeup = isGentleWakeup ?? this.isGentleWakeup
      ..isImpedance = isImpedance ?? this.isImpedance
      ..blinkNum = blinkNum ?? this.blinkNum
      ..wakeUpTime = wakeUpTime ?? this.wakeUpTime
      ..musicFileList = musicFileList ?? this.musicFileList
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime;
  }
}

HospitalCongigDataMusicFileList $HospitalCongigDataMusicFileListFromJson(
    Map<String, dynamic> json) {
  final HospitalCongigDataMusicFileList hospitalCongigDataMusicFileList = HospitalCongigDataMusicFileList();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    hospitalCongigDataMusicFileList.id = id;
  }
  final String? musicName = jsonConvert.convert<String>(json['musicName']);
  if (musicName != null) {
    hospitalCongigDataMusicFileList.musicName = musicName;
  }
  final String? musicIco = jsonConvert.convert<String>(json['musicIco']);
  if (musicIco != null) {
    hospitalCongigDataMusicFileList.musicIco = musicIco;
  }
  final String? musicPath = jsonConvert.convert<String>(json['musicPath']);
  if (musicPath != null) {
    hospitalCongigDataMusicFileList.musicPath = musicPath;
  }
  return hospitalCongigDataMusicFileList;
}

Map<String, dynamic> $HospitalCongigDataMusicFileListToJson(
    HospitalCongigDataMusicFileList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['musicName'] = entity.musicName;
  data['musicIco'] = entity.musicIco;
  data['musicPath'] = entity.musicPath;
  return data;
}

extension HospitalCongigDataMusicFileListExtension on HospitalCongigDataMusicFileList {
  HospitalCongigDataMusicFileList copyWith({
    int? id,
    String? musicName,
    String? musicIco,
    String? musicPath,
  }) {
    return HospitalCongigDataMusicFileList()
      ..id = id ?? this.id
      ..musicName = musicName ?? this.musicName
      ..musicIco = musicIco ?? this.musicIco
      ..musicPath = musicPath ?? this.musicPath;
  }
}